<!--
 * @Descripttion: 项目看板维权公示牌
 * @version: 
 * @Author: zhangfan
 * @email: 2207044692@qq.com
 * @Date: 2021-07-30 09:30:15
 * @LastEditors: zhangfan
 * @LastEditTime: 2021-08-04 17:52:10
-->
<template>
  <div class="contentBox">
    <div class="container">
      <div class="title">
        <span>维权公示牌</span>
      </div>
      <div :class="hasRightsSignImg ? 'rightsSignBox' : 'rightsBox'">
        <div class="rightsSignImg">
          <el-image
            v-if="hasRightsSignImg"
            :src="rightsSignImgUrl"
            :preview-src-list="srcList"
          >
            <div slot="error" class="image-slot">
              <span>- 维权公示牌加载失败 -</span>
            </div>
          </el-image>
          <span v-else>- 暂无维权公示牌 -</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import common from '../../kits/common'
export default {
  name: 'rightsSign',
  components: {},
  computed: {},
  data() {
    return {
      rightsSignImgUrl: '',
      srcList: [],
      hasRightsSignImg: false,
    }
  },
  created() {
    this.getShowpublic()
  },
  computed: {
    projectId() {
      return this.$store.getters.eZhouprojectId
    },
  },
  watch: {
    projectId(newVal, oldVal) {
      const vm = this
      vm.getShowpublic()
    },
  },
  methods: {
    getShowpublic() {
      this.axios({
        method: 'post',
        url: 'api-p/projectstats/expand/showpublic',
        data: {
          projectId: this.projectId,
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              if (response.data.result.url) {
                this.hasRightsSignImg = true
                this.rightsSignImgUrl = response.data.result.url
                this.srcList.push(response.data.result.url)
              } else {
                this.hasRightsSignImg = false
              }
            }
          },
          (response) => {
            this.$message({
              message: '数据请求失败',
              type: 'error',
            })
          }
        )
        .catch((error) => {})
    },
  },
}
</script>
<style lang="less" scoped>
.contentBox {
  width: 100%;
  height: 100%;
  padding: 0px 10px 10px 10px;
}
.container {
  width: 100%;
  height: 100%;
  padding: 16px 16px;
  overflow-y: auto;
  background-color: rgba(0, 0, 0, 0.4);
  .title {
    width: 100%;
    height: 30px;
    line-height: 30px;
    &::before {
      content: '';
      display: inline-block;
      height: 4px;
      width: 4px;
      border-radius: 50%;
      background: #5bfcf4;
      position: relative;
      top: -4px;
    }
    span {
      font-size: 16px;
      // font-family: Source Han Sans CN;
      font-weight: 400;
      color: #5bfcf4;
      margin-left: 6px;
    }
  }
  .rightsSignBox {
    width: 100%;
    height: calc(100% - 50px);
    padding: 10px 30px;
    .rightsSignImg {
      color: #b8e8fa;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
  .rightsBox {
    width: 100%;
    height: calc(100% - 50px);
    padding: 10px 30px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    .rightsSignImg {
      color: #b8e8fa;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
}
</style>
